const mysql = require('mysql');

let pool = mysql.createPool({
    host: '127.0.0.1',
    user: 'root',
    password: 'duxing_zst',
    database: 'duxing'
})

module.exports = {
    query: (sql, args) => {
        let p1 = new Promise((resolve, reject) => {
            pool.query(sql, [...args], (err, results, fields) => {
                if (err) {
                    reject(err);
                }
                else {
                    resolve(results);
                }
            })
        })
        return p1;
    }
}
